package day07.zero;

import java.util.Scanner;

/**
 * 说明:
 *
 * @author: luohaowei
 * @date:2023/2/20
 **/
public class one {
    public static void main(String[] args) {
        Scanner scan=new Scanner(System.in);
        System.out.println("请输入机票原价");
        double price= scan.nextDouble();
        System.out.println("请输入月份");
        int month=scan.nextInt();
        System.out.println("请选择舱位:1.头等舱 2.商务舱 3.经济舱");
        int type=scan.nextInt();
        double lpl=lpl(price,month,type);
        if(lpl!=-1){
            System.out.println("机票的最终价格为:"+lpl);
        }

    }
    public static double lpl(double price,int month,int type){
        double lpl=0.0;

        if (month<1||month>12){
            System.out.println("月份输入错误");
            return -1;
        }
        if (type<1||type>3){
            System.out.println("舱位输入错误");
            return -1;
        }
        if (month>=5||month<=10){
            switch (type){
              case 1:
                 lpl=price*0.8;
              case 2:
                  lpl=price*0.75;
              case 3:
                  lpl=price*0.7;
                  break;

            }
        }else{
            switch (type){
                case 1:
                    lpl=price*0.9;
                case 2:
                    lpl=price*0.8;
                case 3:
                    lpl=price*0.7;
                    break;
            }
        }


        return lpl;
    }
}
/*
Scanner scan=new Scanner(System.in);
        System.out.println("请输入机票原价");
        double price= scan.nextDouble();
        System.out.println("请输入月份");
        int month=scan.nextInt();
        System.out.println("请选择舱位:1.头等舱 2.商务舱 3.经济舱");
        int type=scan.nextInt();
        double lpl=lpl(price,month,type);
        if(lpl!=-1){
            System.out.println("机票的最终价格为:"+lpl);
        }

    }
    public static double lpl(double price,int month,int type){
        double lpl=0.0;

        if (month<1||month>12){
            System.out.println("月份输入错误");
            return -1;
        }
        if (type<1||type>3){
            System.out.println("舱位输入错误");
            return -1;
        }
        if (month>=5||month<=10){
            switch (type){
              case 1:
                 lpl=price*0.8;
              case 2:
                  lpl=price*0.75;
              case 3:
                  lpl=price*0.7;
                  break;

            }
        }else{
            switch (type){
                case 1:
                    lpl=price*0.9;
                case 2:
                    lpl=price*0.8;
                case 3:
                    lpl=price*0.7;
                    break;
            }
        }


        return lpl;
    }
}
 */
